﻿using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Looptribe.Moodlin8.UIHelper
{
    class SearchTemplateSelector : DataTemplateSelector
    {
        public DataTemplate AssignmentTemplate { get; set; }
        public DataTemplate ContactTemplate { get; set; }
        public DataTemplate CourseTemplate { get; set; }

        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            var typeName = item.GetType().Name;
            switch (typeName)
            {
                case "AssignmentWrapper":
                    return AssignmentTemplate;
                case "CourseUserWrapper":
                    return ContactTemplate;
                case "CoursesCourseWrapper":
                    return CourseTemplate;
            }
            return ContactTemplate;
        }
    }
}
